/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package svp;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author kandamaran
 */
@Entity
@Table(name = "customer_city_state", catalog = "svpdatabase", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CustomerCityState.cityAll", query = "SELECT c.city FROM CustomerCityState c"),
    @NamedQuery(name = "CustomerCityState.stateAll", query = "SELECT DISTINCT c.state FROM CustomerCityState c"),
    @NamedQuery(name = "CustomerCityState.findAll", query = "SELECT c FROM CustomerCityState c"),
    @NamedQuery(name = "CustomerCityState.findByCity", query = "SELECT c FROM CustomerCityState c WHERE c.city = :city"),
    @NamedQuery(name = "CustomerCityState.findByState", query = "SELECT c FROM CustomerCityState c WHERE c.state = :state"),
    @NamedQuery(name = "CustomerCityState.findBySno", query = "SELECT c FROM CustomerCityState c WHERE c.sno = :sno")})
public class CustomerCityState implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @Column(name = "city")
    private String city;
    @Basic(optional = false)
    @Column(name = "state")
    private String state;
    @Id
    @Basic(optional = false)
    @Column(name = "sno")
    private Integer sno;

    public CustomerCityState() {
    }

    public CustomerCityState(Integer sno) {
        this.sno = sno;
    }

    public CustomerCityState(Integer sno, String city, String state) {
        this.sno = sno;
        this.city = city;
        this.state = state;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        String oldCity = this.city;
        this.city = city;
        changeSupport.firePropertyChange("city", oldCity, city);
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        String oldState = this.state;
        this.state = state;
        changeSupport.firePropertyChange("state", oldState, state);
    }

    public Integer getSno() {
        return sno;
    }

    public void setSno(Integer sno) {
        Integer oldSno = this.sno;
        this.sno = sno;
        changeSupport.firePropertyChange("sno", oldSno, sno);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sno != null ? sno.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CustomerCityState)) {
            return false;
        }
        CustomerCityState other = (CustomerCityState) object;
        if ((this.sno == null && other.sno != null) || (this.sno != null && !this.sno.equals(other.sno))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "svp.CustomerCityState[ sno=" + sno + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
